LassoScript Utility
Basics Browse Detail

[Thread_Lock->Lock]

Tag Link [Thread_Lock->Lock] Category Threads
Type Member Source Available No
Support Preferred Version 6.0
Change Unchanged Data Source Any
Output Type Boolean Security Tag
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0

Description

Locks a thread lock with an optional timeout value. If another process has locked the thread lock then this tag will pause until the thread lock is unlocked or the timeout value is reached.

Returns True if the thread lock was acquired or False if the timeout value was reached.

Once a thread lock is locked, any subsequent attempts to acquire a lock will wait until the thread is unlocked. If several pages attempt to acquire a lock simultaneously, one will end up the lock and the others will have to wait until it has released it before they can access the same resource.

Note: The use of thread tools is entirely voluntary. There is nothing in Lasso that prevents access to the same shared resource, but the diligent use of the thread tools will ensure predictable results.

Syntax

[Global: 'myLock' = (Thread_Lock)]

[if: $myLock->(Lock: 1000)]
...
[$myLock->(Unlock)]
[/If]

Parameters

Optional Parameters
Timeout The number of milliseconds which the tag should wait to acquire the lock. If this timeout value is reached, False is returned. Default is to wait forever.

Examples

See the Lasso 8 Language Guide for examples of how to use this tag.